#include "MeteoroliteSharpe.h"

MeteoroliteSharpe::MeteoroliteSharpe()
{
}

MeteoroliteSharpe::~MeteoroliteSharpe()
{
}

Meteorolite* MeteoroliteSharpe::getMete()
{
	return m_Mete;
}

float MeteoroliteSharpe::getDegree()
{
	return m_Degree;
}

float MeteoroliteSharpe::getHP()
{
	return m_HP;
}

int MeteoroliteSharpe::getDamaged()
{
	return m_Damaged;
}

void MeteoroliteSharpe::bindMete(Sprite* sprite)
{
	this->m_Mete = Meteorolite::create();
	m_Mete->bindSprite(sprite);
}

void MeteoroliteSharpe::reviseHP(float damage)
{
	float temp;
	//temp = this->getMete()->getVel().getDistance(Point(0,0)) * 
}

void MeteoroliteSharpe::initMeteSharpe(float hp, float degree, int damaged)
{
	m_HP = hp;
	m_Degree = degree;
	m_Damaged = damaged;
}

void MeteoroliteSharpe::initMeteSharpe(float degree, int damaged)
{
	m_Degree = degree;
	m_Damaged = damaged;
}

NormalMete::NormalMete()
{
	initMeteSharpe(500.0, 1.5, 0);
}

NormalMete::~NormalMete()
{
}

void NormalMete::changeSprite()
{
	if (getHP() > 150 && getDamaged() != 0){
		SpriteFrame* temp = SpriteFrameCache::getInstance()->getSpriteFrameByName("s_star1.png");
		getMete()->getSprite()->setSpriteFrame(temp);
		//getSprite()->setTexture("s_star1.png");
		initMeteSharpe(1.5, 0);
	}
	else if (getHP() > 100 && getHP() <= 150 && getDamaged() != 1){
		SpriteFrame* temp = SpriteFrameCache::getInstance()->getSpriteFrameByName("s_star2.png");
		getMete()->getSprite()->setSpriteFrame(temp);
		//getStar()->getSprite()->setTexture("s_star2.png");
		initMeteSharpe(1.0, 1);
	}
	else if (getHP() > 50 && getHP() <= 100 && getDamaged() != 2){
		SpriteFrame* temp = SpriteFrameCache::getInstance()->getSpriteFrameByName("s_star3.png");
		getMete()->getSprite()->setSpriteFrame(temp);
		//getSprite()->setTexture("s_star3.png");
		initMeteSharpe(0.5, 2);
	}
	else if (getHP() > 0 && getHP() <= 50 && getDamaged() != 3){
		SpriteFrame* temp = SpriteFrameCache::getInstance()->getSpriteFrameByName("s_star4.png");
		getMete()->getSprite()->setSpriteFrame(temp);
		//getSprite()->setTexture("s_star4.png");
		initMeteSharpe(0.25, 3);
	}
}